#!/usr/bin/python
#
# Copyright (c) 2009 Julius Volz
# See LICENSE for details.

import config

indent_level = 0

def log(level, msg):
  global indent_level
  if config.verbosity < level:
    return
  lines = msg.split('\n')
  lines = [' ' * indent_level + line for line in lines]
  print '\n'.join(lines),

def log_indent(level, msg):
  global indent_level
  if config.verbosity < level:
    return
  log(level, msg)
  indent_level += 2

def log_outdent(level, msg):
  global indent_level
  if config.verbosity < level:
    return
  indent_level -= 2
  log(level, msg)
